锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久精品国产清自在天天线,av男人的天堂在线观看,日韩欧美中文字幕在线视频http://www.aygfsteel.com/lucia/zh-cnWed, 18 Jun 2025 15:47:20 GMTWed, 18 Jun 2025 15:47:20 GMT60How to add zoom function into your eclipse plugin?http://www.aygfsteel.com/lucia/archive/2005/10/25/16814.htmllucialuciaTue, 25 Oct 2005 15:38:00 GMThttp://www.aygfsteel.com/lucia/archive/2005/10/25/16814.htmlhttp://www.aygfsteel.com/lucia/comments/16814.htmlhttp://www.aygfsteel.com/lucia/archive/2005/10/25/16814.html#Feedback0http://www.aygfsteel.com/lucia/comments/commentRss/16814.htmlhttp://www.aygfsteel.com/lucia/services/trackbacks/16814.html 1. Add the action into the toolbar:
...in Class: ActionBarContributor...
    ...in Method: contributeToToolBar...
        toolBarManager.add(getAction(GEFActionConstants.ZOOM_IN));
        toolBarManager.add(getAction(GEFActionConstants.ZOOM_OUT));
        toolBarManager.add(new ZoomComboContributionItem(getPage()));

2. Connect the Zoom Manager with your edit part:
...in Class: YourEditor...
    ...in Method: configureGraphicalViewer...
        ScalableFreeformRootEditPart rootEditPart= new ScalableFreeformRootEditPart();
        getGraphicalViewer().setRootEditPart(rootEditPart);

        ZoomManager manager = rootEditPart.getZoomManager();
        IAction action = new ZoomInAction(manager);
        getActionRegistry().registerAction(action);
        action = new ZoomOutAction(manager);
        getActionRegistry().registerAction(action);

        //define the zoom possibilities
        double[] zoomLevels = new double[] {0.25,0.5,0.75,1.0,1.5,2.0,2.5,3.0,4.0};
        manager.setZoomLevels(zoomLevels);
   ...in Method: getAdapter...
        if (type == ZoomManager.class)
              return ((ScalableFreeformRootEditPart) getGraphicalViewer().
                        getRootEditPart()).getZoomManager();

That's all! Now you have two buttons to zoom in and zoom out. And you can see the zoom level in percent.  With the example here you  can change  zoom level from 25% to 400%.



lucia 2005-10-25 23:38 鍙戣〃璇勮
]]>
Linked resources in Eclipsehttp://www.aygfsteel.com/lucia/archive/2005/10/17/15690.htmllucialuciaSun, 16 Oct 2005 21:25:00 GMThttp://www.aygfsteel.com/lucia/archive/2005/10/17/15690.htmlhttp://www.aygfsteel.com/lucia/comments/15690.htmlhttp://www.aygfsteel.com/lucia/archive/2005/10/17/15690.html#Feedback0http://www.aygfsteel.com/lucia/comments/commentRss/15690.htmlhttp://www.aygfsteel.com/lucia/services/trackbacks/15690.html
IProject project = workspace.getProject("Project");//assume this exists
IFolder link = project.getFolder("Link");
IPath location = new Path("C:\TEMP\folder");
if (workspace.validateLinkLocation(location).isOK()) {
link.createLink(location, IResource.NONE, null);
} else {
//invalid location, throw an exception or warn user
}

This example will create a linked folder called "Link" that is located at "c:\temp\folder".

link.getFullPath() => "/Project/Link"
link.getLocation() => "c:\temp\folder"
link.getRawLocation() => "temp/folder"
link.isLinked() => "true"
IFile child = link.getFile("abc.txt");
child.create(...);
child.getFullPath() => "/Project/Link/abc.txt"
child.getLocation() => "c:\temp\folder\abc.txt"
child.getRawLocation() => "c:\temp\folder\abc.txt"
child.isLinked() => "false"



lucia 2005-10-17 05:25 鍙戣〃璇勮
]]>
How to open external files in eclipse editor?http://www.aygfsteel.com/lucia/archive/2005/09/21/13661.htmllucialuciaWed, 21 Sep 2005 09:50:00 GMThttp://www.aygfsteel.com/lucia/archive/2005/09/21/13661.htmlhttp://www.aygfsteel.com/lucia/comments/13661.htmlhttp://www.aygfsteel.com/lucia/archive/2005/09/21/13661.html#Feedback0http://www.aygfsteel.com/lucia/comments/commentRss/13661.htmlhttp://www.aygfsteel.com/lucia/services/trackbacks/13661.html
                 IEditorInput input= createEditorInput(selectedFile);
                 String editorId= getEditorId(selectedFile);
                 IWorkbenchPage page= fWindow.getActivePage();
                 try {
                     page.openEditor(input, editorId);
                 } catch (PartInitException e) {
                     //EditorsPlugin.log(e.getStatus());
                 }

This idea comes from org.eclipse.ui.internal.editors.text.OpenExternalFileAction. In this class you can also find the implementation for the methods "createEditorInput" and "getEditorId".


lucia 2005-09-21 17:50 鍙戣〃璇勮
]]>
Access user defined environment variable inside the java program with jdk1.4http://www.aygfsteel.com/lucia/archive/2005/09/14/12951.htmllucialuciaTue, 13 Sep 2005 18:36:00 GMThttp://www.aygfsteel.com/lucia/archive/2005/09/14/12951.htmlhttp://www.aygfsteel.com/lucia/comments/12951.htmlhttp://www.aygfsteel.com/lucia/archive/2005/09/14/12951.html#Feedback0http://www.aygfsteel.com/lucia/comments/commentRss/12951.htmlhttp://www.aygfsteel.com/lucia/services/trackbacks/12951.html import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
* Environment class simulates the System.getenv() method which is deprecated
* on java 1.4.2
*
* @author v-josp
*
*/
public class TestRoot
{
//result of all enviornment variables
private static BufferedReader commandResult;

static
{
String cmd = null;
String os = null;

//getting the OS name
os = System.getProperty("os.name").toLowerCase();

// according to OS set the command to execute
if(os.startsWith("windows"))
{
cmd = "cmd /c SET";
}
else
{
cmd="env";
}

try
{
//execute the command and get the result in the form of InputStream
Process p = Runtime.getRuntime().exec(cmd);

//parse the InputStream data
InputStreamReader isr = new InputStreamReader(p.getInputStream());
commandResult= new BufferedReader(isr);
}
catch (Exception e)
{
System.out.println("OSEnvironment.class error: " + cmd + ":" + e);
}
}

/**
* This method is used to get the path of the given enviornment variable. This
* method tries to simulates the System.getenv() which is deprecated on java 1.4.2
*
* @param String - name of the environment variable
* @param String - default value
* @return
*/
public static String getenv(String envName,String defaultValue)
{
String line = null;
try
{
while ((line = commandResult.readLine()) != null)
{
if(line.indexOf(envName)>-1)
{
return line.substring(line.indexOf(envName)+envName.length()+1);
}
}
return defaultValue;
}
catch (Exception e)
{
return defaultValue;
}
}

public static void main(String args[])
{
System.out.println(TestRoot.getenv("CLASSPATH",""));
}
}

Output
_____
F:\software\javaws-1_2-dev\jnlp.jar;


lucia 2005-09-14 02:36 鍙戣〃璇勮
]]>
How to get the the currect path where program runs?http://www.aygfsteel.com/lucia/archive/2005/09/10/12637.htmllucialuciaSat, 10 Sep 2005 14:12:00 GMThttp://www.aygfsteel.com/lucia/archive/2005/09/10/12637.htmlhttp://www.aygfsteel.com/lucia/comments/12637.htmlhttp://www.aygfsteel.com/lucia/archive/2005/09/10/12637.html#Feedback0http://www.aygfsteel.com/lucia/comments/commentRss/12637.htmlhttp://www.aygfsteel.com/lucia/services/trackbacks/12637.htmltry {
File currDir = new File (".");
System.out.println("Dir: " + currDir.getCanonicalPath());
}
catch (IOException ex){
//
}




lucia 2005-09-10 22:12 鍙戣〃璇勮
]]>
How to add context menu into editor?http://www.aygfsteel.com/lucia/archive/2005/09/07/12326.htmllucialuciaWed, 07 Sep 2005 09:07:00 GMThttp://www.aygfsteel.com/lucia/archive/2005/09/07/12326.htmlhttp://www.aygfsteel.com/lucia/comments/12326.htmlhttp://www.aygfsteel.com/lucia/archive/2005/09/07/12326.html#Feedback0http://www.aygfsteel.com/lucia/comments/commentRss/12326.htmlhttp://www.aygfsteel.com/lucia/services/trackbacks/12326.html There are three steps:

1. Define the action. Please read the following example code:

/**
 *  What I want to realize is to provide a "copy" menu item in popup menu
 *  whenever the user selects the object "Example".
 */

public class CopyExampleAction extends org.eclipse.gef.ui.actions.SelectionAction
{
    private static final String
        COPY_REQUEST = "COPY";  //$NON-NLS-1$
    public static final String
        COPY = "COPY";   //$NON-NLS-1$

    Request request;

    public CopyExampleAction(IWorkbenchPart part) {
        super(part);
        request = new Request(COPY_REQUEST);
        setText("copy Example");
        setId(COPY);
        setImageDescriptor(
            ImageDescriptor.createFromFile(ExamplePlugin.class,"icons/copy.gif")); //$NON-NLS-1$
        setHoverImageDescriptor(getImageDescriptor());
    }

    protected boolean calculateEnabled() {
        return canPerformAction();
    }

    private boolean canPerformAction() {
        if (getSelectedObjects().isEmpty())
            return false;
        List parts = getSelectedObjects();
        for (int i=0; i<parts.size(); i++){
            Object o = parts.get(i);
            if (!(o instanceof EditPart))
                return false;
            EditPart part = (EditPart)o;
           // This menu item will only be activated if an object of Typ "Example" is selected.
            if (!(part.getModel() instanceof Example))
                return false;
            }
        }
        return true;
    }

// What happened for this action is defined by the edit part of this object.
    private Command getCommand() {
        List editparts = getSelectedObjects();
        CompoundCommand cc = new CompoundCommand();
        cc.setDebugLabel("Copy Example");//$NON-NLS-1$
        for (int i=0; i < editparts.size(); i++) {
            EditPart part = (EditPart)editparts.get(i);
            cc.add(part.getCommand(request));
        }
        return cc;
    }

    public void run() {
        execute(getCommand());
    }
    }

2. Implement the action. In this step you will decide what will exactly happen after the user clicked this menu item. As you have already seen from the code in the step 1, the command for this action is defined in edit part for the object "Example".
So the next you will do is to complete the ExampleEditPolicy for ExampleEditPart.

public class ExampleEditPolicy extends ComponentEditPolicy{
  
    private static final String
    COPY_REQUEST = "COPY",  //$NON-NLS-1$

public Command getCommand(Request request) {
    if (COPY_REQUEST.equals(request.getType()))
        return getCopyExampleCommand();
    return super.getCommand(request);
}

protected Command getCopyExampleCommand(){
 // The implementation of CopyExampleCommand is simple, will not be explained here.
    CopyExampleCommand command = new CopyExampleCommand();
    command.setCopyObject((Example)getHost().getModel());
    return command;
}
}

3. Add the action into Context Menu.
There is always a class to provider the context menu, the next step is to add this defined action into the context menu.

public class ExampleContextMenuProvider extends ContextMenuProvider {
  
    private ActionRegistry actionRegistry;
   
    public ExampleContextMenuProvider(EditPartViewer viewer, ActionRegistry registry) {
        super(viewer);
        setActionRegistry(registry);
    }

    public void buildContextMenu(IMenuManager manager) {
        GEFActionConstants.addStandardActionGroups(manager);
        IAction action;
        action = getActionRegistry().getAction(CopyExampleAction.COPY);
        if (action.isEnabled())
            manager.appendToGroup(GEFActionConstants.GROUP_REST, action);
    }   

    private ActionRegistry getActionRegistry() {
        return actionRegistry;
    }

    private void setActionRegistry(ActionRegistry registry) {
        actionRegistry = registry;
    }
}

4. Add the action into editor. There is a method "createActions" in editor. Add the action in it. That's all.

protected void createActions() {
  super.createActions();
  ActionRegistry registry = getActionRegistry();
  IAction action;

  action = new CopyExampleAction(this);
  registry.registerAction(action);
  getSelectionActions().add(action.getId());
}



lucia 2005-09-07 17:07 鍙戣〃璇勮
]]>
Set Colorhttp://www.aygfsteel.com/lucia/archive/2005/09/02/11849.htmllucialuciaFri, 02 Sep 2005 12:31:00 GMThttp://www.aygfsteel.com/lucia/archive/2005/09/02/11849.htmlhttp://www.aygfsteel.com/lucia/comments/11849.htmlhttp://www.aygfsteel.com/lucia/archive/2005/09/02/11849.html#Feedback0http://www.aygfsteel.com/lucia/comments/commentRss/11849.htmlhttp://www.aygfsteel.com/lucia/services/trackbacks/11849.html

lucia 2005-09-02 20:31 鍙戣〃璇勮
]]>
Providing Help Documentation in Eclipse Pluginhttp://www.aygfsteel.com/lucia/archive/2005/08/29/11494.htmllucialuciaMon, 29 Aug 2005 13:28:00 GMThttp://www.aygfsteel.com/lucia/archive/2005/08/29/11494.htmlhttp://www.aygfsteel.com/lucia/comments/11494.htmlhttp://www.aygfsteel.com/lucia/archive/2005/08/29/11494.html#Feedback0http://www.aygfsteel.com/lucia/comments/commentRss/11494.htmlhttp://www.aygfsteel.com/lucia/services/trackbacks/11494.html 1. Create the help content as HTML files and store them in your plug-in directory. Normally we use doc in the name. If there are too many files, you can creat a ZIP file named doc.zip.
2. Decliare the HELP Table of Contents in your plug-in using the org.eclipse.help.toc extension point and specify the table of content files.

Example:
<extension point = "org.eclipse.help.toc">
    <toc     file ="DialogTOC.xml"/>
    <toc     file ="MoreTOC.xml"/>
    <toc     file ="TestTOC.xml"
                primary = "true"
                extradir = "lab">   
    </toc>
</extension>

The table of the contents will be described by one or more XML files. In this example, TestTOC.xml is the primary table of contents file, which describes the structure and order of the other files by linking them together.

Example: TestTOC.xml
<?xml version="1.0" encoding="UTF-8"?>
<?NLS TYPE="org.eclipse.help.toc"?>
<toc label="JDG2E: Help Example TOC">
    <link toc="DialogTOC.xml" />
    <anchor id="moreLabs" />
</toc>

3. Create the table of contents files by linking the topic together.

Example: MoreTOC.xml
<?xml version="1.0" encoding="UTF-8"?>
<?NLS TYPE="org.eclipse.help.toc"?>
<toc link_to="TestToc.xml#moreLabs"
  label="More interesting labs">
  <topic label="JDT Main Topic"  href="html/maintopic.html">
     <topic label="JDT Sub Topic" href="html/subtopic.html"/>
  </topic>
  <topic label="Extra Topic"  href="lab/doc1/info1.html">
    <topic label="Using the extradir attrib" href="lab/doc2/info2.html"/>
  </topic>
</toc>

In addition, you can invove the Eclipse Help system form any Java program indenpendent from Eclipse. This is called "standalone" mode. To do that, you simply use the Platform Runtime Binary version of Eclipse as opposed to the SDK and inovke the main methode in the class org.eclipse.help.internal.standalone.StandaloneHelp. Of course you should pass the location of the plugins directory,which includes the online contents, as a paramter.

(The example used is taken from the book "The JavaTM Developer's Guide to Eclipse".)


lucia 2005-08-29 21:28 鍙戣〃璇勮
]]>
SWT TableViewerhttp://www.aygfsteel.com/lucia/archive/2005/08/29/11462.htmllucialuciaMon, 29 Aug 2005 08:39:00 GMThttp://www.aygfsteel.com/lucia/archive/2005/08/29/11462.htmlhttp://www.aygfsteel.com/lucia/comments/11462.htmlhttp://www.aygfsteel.com/lucia/archive/2005/08/29/11462.html#Feedback2http://www.aygfsteel.com/lucia/comments/commentRss/11462.htmlhttp://www.aygfsteel.com/lucia/services/trackbacks/11462.html闃呰鍏ㄦ枃

lucia 2005-08-29 16:39 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 山丹县| 高邮市| 龙川县| 兰州市| 梅河口市| 津南区| 永仁县| 社旗县| 墨江| 台北市| 满洲里市| 沙坪坝区| 鄯善县| 包头市| 神农架林区| 抚远县| 武义县| 遵化市| 濉溪县| 台中市| 凤冈县| 涡阳县| 延边| 堆龙德庆县| 徐闻县| 潜山县| 化德县| 会泽县| 松滋市| 孙吴县| 玉林市| 焦作市| 峨山| 寻乌县| 渝北区| 邮箱| 柘荣县| 固始县| 广南县| 绿春县| 巴中市|