Skip to content

Commit 22d86e5

Browse files
committed
apply dos2unix to all source files in the tree
1 parent bfef146 commit 22d86e5

File tree

26 files changed

+1440
-1440
lines changed

26 files changed

+1440
-1440
lines changed
Lines changed: 193 additions & 193 deletions
Original file line numberDiff line numberDiff line change
@@ -1,193 +1,193 @@
1-
// -----BEGIN DISCLAIMER-----
2-
/*******************************************************************************
3-
* Copyright (c) 2011, 2021 JCrypTool Team and Contributors
4-
*
5-
* All rights reserved. This program and the accompanying materials are made available under the
6-
* terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
7-
* http://www.eclipse.org/legal/epl-v10.html
8-
*******************************************************************************/
9-
// -----END DISCLAIMER-----
10-
package net.sourceforge.javahexeditor;
11-
12-
import org.eclipse.swt.SWT;
13-
import org.eclipse.swt.custom.StyledText;
14-
import org.eclipse.swt.events.MenuEvent;
15-
import org.eclipse.swt.events.MenuListener;
16-
import org.eclipse.swt.events.SelectionEvent;
17-
import org.eclipse.swt.events.SelectionListener;
18-
import org.eclipse.swt.widgets.Menu;
19-
import org.eclipse.swt.widgets.MenuItem;
20-
import org.jcryptool.core.util.images.ImageService;
21-
import org.jcryptool.editor.text.JCTTextEditorPlugin;
22-
23-
/**
24-
* Context Menu
25-
* @author Thorben Groos
26-
*
27-
*/
28-
public class ContextMenu {
29-
30-
/**
31-
* Adds the context menu to the given styled text
32-
* @param st The styledText where the context menu should be added.
33-
* @param manager JavaHexEditor Manager to get acces to methods like doCopy(), etc.
34-
*/
35-
public static void createMenuForText(StyledText st, Manager manager) {
36-
37-
Menu menu = new Menu(st);
38-
st.setMenu(menu);
39-
40-
MenuItem undoItem = new MenuItem(menu, SWT.None);
41-
undoItem.setText(Texts.ContextMenu_undo);
42-
undoItem.setImage(ImageService.createIconFromURL("platform:/plugin/org.eclipse.ui/icons/full/etool16/undo_edit.png").createImage()); //$NON-NLS-1$
43-
undoItem.addSelectionListener(new SelectionListener() {
44-
45-
@Override
46-
public void widgetSelected(SelectionEvent e) {
47-
manager.doUndo();
48-
}
49-
50-
@Override
51-
public void widgetDefaultSelected(SelectionEvent e) {
52-
// This method did not get called.
53-
}
54-
});
55-
56-
MenuItem redoItem = new MenuItem(menu, SWT.None);
57-
redoItem.setText(Texts.ContextMenu_redo);
58-
redoItem.setImage(ImageService.createIconFromURL("platform:/plugin/org.eclipse.ui/icons/full/etool16/redo_edit.png").createImage()); //$NON-NLS-1$
59-
redoItem.addSelectionListener(new SelectionListener() {
60-
61-
@Override
62-
public void widgetSelected(SelectionEvent e) {
63-
manager.doRedo();
64-
}
65-
66-
@Override
67-
public void widgetDefaultSelected(SelectionEvent e) {
68-
// This method did not get called.
69-
}
70-
});
71-
72-
// Separator between redo and copy
73-
new MenuItem(menu, SWT.SEPARATOR);
74-
75-
MenuItem cutItem = new MenuItem(menu, SWT.None);
76-
cutItem.setText(Texts.ContextMenu_cut);
77-
cutItem.setImage(ImageService.createIconFromURL("platform:/plugin/org.eclipse.ui/icons/full/etool16/cut_edit.png").createImage()); //$NON-NLS-1$
78-
cutItem.addSelectionListener(new SelectionListener() {
79-
80-
@Override
81-
public void widgetSelected(SelectionEvent e) {
82-
manager.doCut();
83-
}
84-
85-
@Override
86-
public void widgetDefaultSelected(SelectionEvent e) {
87-
// This method did not get called.
88-
}
89-
});
90-
91-
MenuItem copyItem = new MenuItem(menu, SWT.None);
92-
copyItem.setText(Texts.ContextMenu_copy);
93-
copyItem.setImage(ImageService.createIconFromURL("platform:/plugin/org.eclipse.ui/icons/full/etool16/copy_edit.png").createImage()); //$NON-NLS-1$
94-
copyItem.addSelectionListener(new SelectionListener() {
95-
96-
@Override
97-
public void widgetSelected(SelectionEvent e) {
98-
manager.doCopy();
99-
}
100-
101-
@Override
102-
public void widgetDefaultSelected(SelectionEvent e) {
103-
// This method did not get called.
104-
}
105-
});
106-
107-
MenuItem pasteItem = new MenuItem(menu, SWT.None);
108-
pasteItem.setText(Texts.ContextMenu_paste);
109-
pasteItem.setImage(ImageService.createIconFromURL("platform:/plugin/org.eclipse.ui/icons/full/etool16/paste_edit.png").createImage()); //$NON-NLS-1$
110-
pasteItem.addSelectionListener(new SelectionListener() {
111-
112-
@Override
113-
public void widgetSelected(SelectionEvent e) {
114-
manager.doPaste();
115-
}
116-
117-
@Override
118-
public void widgetDefaultSelected(SelectionEvent e) {
119-
// This method did not get called.
120-
}
121-
});
122-
123-
// Separator
124-
new MenuItem(menu, SWT.SEPARATOR);
125-
126-
MenuItem switchItem = new MenuItem(menu, SWT.None);
127-
switchItem.setText(Texts.ContextMenu_openin);
128-
switchItem.setImage(ImageService.getImageDescriptor(JCTTextEditorPlugin.PLUGIN_ID, "icons/text_edit.png").createImage()); //$NON-NLS-1$
129-
switchItem.addSelectionListener(new SelectionListener() {
130-
131-
@Override
132-
public void widgetSelected(SelectionEvent e) {
133-
OpenInTexteditor.changeEditor();
134-
}
135-
136-
@Override
137-
public void widgetDefaultSelected(SelectionEvent e) {
138-
// This method did not get called.
139-
}
140-
});
141-
142-
143-
menu.addMenuListener(new MenuListener() {
144-
145-
@Override
146-
public void menuShown(MenuEvent e) {
147-
148-
// Enable / Disable the undo menu entry.
149-
if (manager.canUndo()) {
150-
undoItem.setEnabled(true);
151-
} else {
152-
undoItem.setEnabled(false);
153-
}
154-
155-
// Enable / Disable the redo menu entry
156-
if (manager.canRedo()) {
157-
redoItem.setEnabled(true);
158-
} else {
159-
redoItem.setEnabled(false);
160-
}
161-
162-
// Enable / Disable the cut menu entry
163-
if (manager.isTextSelected() && !manager.isOverwriteMode()) {
164-
cutItem.setEnabled(true);
165-
} else {
166-
cutItem.setEnabled(false);
167-
}
168-
169-
// Enable / Disable the copy menu entry
170-
if (manager.isTextSelected()) {
171-
copyItem.setEnabled(true);
172-
} else {
173-
copyItem.setEnabled(false);
174-
}
175-
176-
// Enable / Disable the paste Item
177-
if (manager.canPaste()) {
178-
pasteItem.setEnabled(true);
179-
} else {
180-
pasteItem.setEnabled(false);
181-
}
182-
}
183-
184-
@Override
185-
public void menuHidden(MenuEvent e) {
186-
// No action required when the menu is closed.
187-
}
188-
});
189-
190-
}
191-
192-
193-
}
1+
// -----BEGIN DISCLAIMER-----
2+
/*******************************************************************************
3+
* Copyright (c) 2011, 2021 JCrypTool Team and Contributors
4+
*
5+
* All rights reserved. This program and the accompanying materials are made available under the
6+
* terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
7+
* http://www.eclipse.org/legal/epl-v10.html
8+
*******************************************************************************/
9+
// -----END DISCLAIMER-----
10+
package net.sourceforge.javahexeditor;
11+
12+
import org.eclipse.swt.SWT;
13+
import org.eclipse.swt.custom.StyledText;
14+
import org.eclipse.swt.events.MenuEvent;
15+
import org.eclipse.swt.events.MenuListener;
16+
import org.eclipse.swt.events.SelectionEvent;
17+
import org.eclipse.swt.events.SelectionListener;
18+
import org.eclipse.swt.widgets.Menu;
19+
import org.eclipse.swt.widgets.MenuItem;
20+
import org.jcryptool.core.util.images.ImageService;
21+
import org.jcryptool.editor.text.JCTTextEditorPlugin;
22+
23+
/**
24+
* Context Menu
25+
* @author Thorben Groos
26+
*
27+
*/
28+
public class ContextMenu {
29+
30+
/**
31+
* Adds the context menu to the given styled text
32+
* @param st The styledText where the context menu should be added.
33+
* @param manager JavaHexEditor Manager to get acces to methods like doCopy(), etc.
34+
*/
35+
public static void createMenuForText(StyledText st, Manager manager) {
36+
37+
Menu menu = new Menu(st);
38+
st.setMenu(menu);
39+
40+
MenuItem undoItem = new MenuItem(menu, SWT.None);
41+
undoItem.setText(Texts.ContextMenu_undo);
42+
undoItem.setImage(ImageService.createIconFromURL("platform:/plugin/org.eclipse.ui/icons/full/etool16/undo_edit.png").createImage()); //$NON-NLS-1$
43+
undoItem.addSelectionListener(new SelectionListener() {
44+
45+
@Override
46+
public void widgetSelected(SelectionEvent e) {
47+
manager.doUndo();
48+
}
49+
50+
@Override
51+
public void widgetDefaultSelected(SelectionEvent e) {
52+
// This method did not get called.
53+
}
54+
});
55+
56+
MenuItem redoItem = new MenuItem(menu, SWT.None);
57+
redoItem.setText(Texts.ContextMenu_redo);
58+
redoItem.setImage(ImageService.createIconFromURL("platform:/plugin/org.eclipse.ui/icons/full/etool16/redo_edit.png").createImage()); //$NON-NLS-1$
59+
redoItem.addSelectionListener(new SelectionListener() {
60+
61+
@Override
62+
public void widgetSelected(SelectionEvent e) {
63+
manager.doRedo();
64+
}
65+
66+
@Override
67+
public void widgetDefaultSelected(SelectionEvent e) {
68+
// This method did not get called.
69+
}
70+
});
71+
72+
// Separator between redo and copy
73+
new MenuItem(menu, SWT.SEPARATOR);
74+
75+
MenuItem cutItem = new MenuItem(menu, SWT.None);
76+
cutItem.setText(Texts.ContextMenu_cut);
77+
cutItem.setImage(ImageService.createIconFromURL("platform:/plugin/org.eclipse.ui/icons/full/etool16/cut_edit.png").createImage()); //$NON-NLS-1$
78+
cutItem.addSelectionListener(new SelectionListener() {
79+
80+
@Override
81+
public void widgetSelected(SelectionEvent e) {
82+
manager.doCut();
83+
}
84+
85+
@Override
86+
public void widgetDefaultSelected(SelectionEvent e) {
87+
// This method did not get called.
88+
}
89+
});
90+
91+
MenuItem copyItem = new MenuItem(menu, SWT.None);
92+
copyItem.setText(Texts.ContextMenu_copy);
93+
copyItem.setImage(ImageService.createIconFromURL("platform:/plugin/org.eclipse.ui/icons/full/etool16/copy_edit.png").createImage()); //$NON-NLS-1$
94+
copyItem.addSelectionListener(new SelectionListener() {
95+
96+
@Override
97+
public void widgetSelected(SelectionEvent e) {
98+
manager.doCopy();
99+
}
100+
101+
@Override
102+
public void widgetDefaultSelected(SelectionEvent e) {
103+
// This method did not get called.
104+
}
105+
});
106+
107+
MenuItem pasteItem = new MenuItem(menu, SWT.None);
108+
pasteItem.setText(Texts.ContextMenu_paste);
109+
pasteItem.setImage(ImageService.createIconFromURL("platform:/plugin/org.eclipse.ui/icons/full/etool16/paste_edit.png").createImage()); //$NON-NLS-1$
110+
pasteItem.addSelectionListener(new SelectionListener() {
111+
112+
@Override
113+
public void widgetSelected(SelectionEvent e) {
114+
manager.doPaste();
115+
}
116+
117+
@Override
118+
public void widgetDefaultSelected(SelectionEvent e) {
119+
// This method did not get called.
120+
}
121+
});
122+
123+
// Separator
124+
new MenuItem(menu, SWT.SEPARATOR);
125+
126+
MenuItem switchItem = new MenuItem(menu, SWT.None);
127+
switchItem.setText(Texts.ContextMenu_openin);
128+
switchItem.setImage(ImageService.getImageDescriptor(JCTTextEditorPlugin.PLUGIN_ID, "icons/text_edit.png").createImage()); //$NON-NLS-1$
129+
switchItem.addSelectionListener(new SelectionListener() {
130+
131+
@Override
132+
public void widgetSelected(SelectionEvent e) {
133+
OpenInTexteditor.changeEditor();
134+
}
135+
136+
@Override
137+
public void widgetDefaultSelected(SelectionEvent e) {
138+
// This method did not get called.
139+
}
140+
});
141+
142+
143+
menu.addMenuListener(new MenuListener() {
144+
145+
@Override
146+
public void menuShown(MenuEvent e) {
147+
148+
// Enable / Disable the undo menu entry.
149+
if (manager.canUndo()) {
150+
undoItem.setEnabled(true);
151+
} else {
152+
undoItem.setEnabled(false);
153+
}
154+
155+
// Enable / Disable the redo menu entry
156+
if (manager.canRedo()) {
157+
redoItem.setEnabled(true);
158+
} else {
159+
redoItem.setEnabled(false);
160+
}
161+
162+
// Enable / Disable the cut menu entry
163+
if (manager.isTextSelected() && !manager.isOverwriteMode()) {
164+
cutItem.setEnabled(true);
165+
} else {
166+
cutItem.setEnabled(false);
167+
}
168+
169+
// Enable / Disable the copy menu entry
170+
if (manager.isTextSelected()) {
171+
copyItem.setEnabled(true);
172+
} else {
173+
copyItem.setEnabled(false);
174+
}
175+
176+
// Enable / Disable the paste Item
177+
if (manager.canPaste()) {
178+
pasteItem.setEnabled(true);
179+
} else {
180+
pasteItem.setEnabled(false);
181+
}
182+
}
183+
184+
@Override
185+
public void menuHidden(MenuEvent e) {
186+
// No action required when the menu is closed.
187+
}
188+
});
189+
190+
}
191+
192+
193+
}

0 commit comments

Comments
 (0)